#encoding=utf8
'''
Created on 2012-10-25

@author: geminiblue
'''
from SysProcessor import SysProcessor
from pub import Func, UserDict, RoomDict;
from pub.Config import Config
class SYSGRULClass(SysProcessor):
    '''
    系统命令，推送新的版本到客户端
    @author: geminiblue
    入口命令：SYSGRUL#CommandId#NewVersion#ForceUpdate#DownloadUrl#ReaseLog#SysUserName#SysUserPassword
    出口命令:SYSGRUL#CommandId#RoomId#SysUserId#base64encode(UserID1^UserMark|UserID2^UserMark|UserID3^UserMark.....)
    '''


    def __init__(self):
        '''
        Constructor
        '''
        SysProcessor.__init__(self)
        self.__roomId = Config.I_SYS_ZERO

    def dataValidtor(self, cmdContent):
        if not cmdContent:
            return False;
        paraLen = len(cmdContent);
        if paraLen == 3:      
            self.__roomId = Func.strToInt(cmdContent[0], Config.I_SYS_ZERO);
            self.__sysUserName = cmdContent[1];
            self.__sysUserPass = cmdContent[2]                
            return True;        
        return False;

    def outData(self,):
        '''
        @todo: 完成获取房间用户列表逻辑
        '''
        if not self.validSystemUser():
            Func.debugInfo("系统用户登陆失败")
        '''
        @var room Room: 
        '''
        room = RoomDict.getRoomFromDictById(self.__roomId);
        if not room:
            return False;
        userList = room.get_user_list()
        pass 
if __name__=="__main__":
   oSYS = SYSGRULClass()